<!--
 * @Author: Terry
 * @Date: 2024-01-31 17:26:14
 * @LastEditors: Terry
 * @LastEditTime: 2024-06-03 16:02:40
 * @Description: file content
 * @FilePath: \auxface_web\src\views\certificate\risk\components\template\formDialog.vue
-->
<template>
    <dialogPopUp @submit="submit" :ruleForm="ruleForm" :rules="rules" ref="dialogPopUp">
        <el-form-item :label="$t('certificate.global.name')" prop="name">
          <el-input
            v-model="ruleForm.name"
            :placeholder="$t('certificate.global.enterName')"
            maxlength="50"
            show-word-limit
        ></el-input>
        </el-form-item>
        <el-form-item :label="$t('certificate.global.subtitle')" prop="subtitle">
          <el-input
            v-model="ruleForm.subtitle"
            :placeholder="$t('certificate.global.enterSubtitle')"
            maxlength="50"
            show-word-limit
        ></el-input>
        </el-form-item>
        <el-form-item :label="$t('certificate.global.corpName')" prop="corpCode">
          <el-select
            popper-class="selectClass"
            v-model="ruleForm.corpCode"
            clearable
            :placeholder="$t('certificate.global.corpCodeRequired')"
          >
            <el-option
              v-for="value in projectCorpList"
              :key="value.corpCode"
              :label="value.corpName"
              :value="value.corpCode"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('certificate.global.remark')">
          <el-input
            type="textarea"
            v-model="ruleForm.remark"
            :placeholder="$t('certificate.global.remarkPlaceholder')"
          ></el-input>
        </el-form-item>
  </dialogPopUp>
  
    <!-- 设备添加: end -->
  </template>
  
  <script>
  import { projectCorpList } from "@/api/common";
  export default {
    data() {
      return {
        projectCorpList: [],
        type: [],
        ruleForm: {
          type:"1",
        },
        rules: {
          name: [
            { required: true, message: this.$t('certificate.global.enterName'), trigger: 'blur' },
          ],
          corpCode: [
            { required: true, message: this.$t('certificate.global.corpCodeRequired'), trigger: 'blur' },
          ],
          type: [
            { required: true, message: this.$t('certificate.global.typeCodeRequired'), trigger: 'blur' },
          ],
          exitTime: [
            { required: true, message: this.$t('certificate.global.enterExitTime'), trigger: 'blur' },
          ],
        },
      };
    },
    methods: {
      show(ruleForm){
        projectCorpList().then(res=>{
          this.projectCorpList = res.data;
        })
        console.log(ruleForm);
        this.ruleForm = ruleForm;
        
        this.$refs.dialogPopUp.show();
        this.$refs.dialogPopUp.changeController('risk/type');
      },
     // 提交数据
      submit(data){
        this.$emit("listUpdate",data);
        this.$refs.dialogPopUp.goBack();
      },
    },
    mounted() {
     
    },
  };
  </script>
  
  <style>
  </style>
  